#include <.\shaders\standard.hlsli>
#include <.\shaders\WR2Parameters.hlsli>

struct PixelInputType
{
	float4 position : SV_POSITION;
	float2 tex : TEXCOORD0;
	float3 normal : NORMAL;
	float4 lightViewPosition : TEXCOORD1;
};

PixelInputType vs_main(VS_INPUT input)
{
	PixelInputType output;

	// Change the position vector to be 4 units for proper matrix calculations.
	input.Position.w = 1.0f;

	// Calculate the position of the vertex against the world, view, and projection matrices.
	output.position = mul(input.Position, world);
	output.position = mul(output.position, view);
	output.position = mul(output.position, projection);

	// Calculate the position of the vertice as viewed by the light source.
	output.lightViewPosition = mul(input.Position, world);
	output.lightViewPosition = mul(output.lightViewPosition, lightViewMatrix);
	output.lightViewPosition = mul(output.lightViewPosition, lightProjectionMatrix);

	// Store the texture coordinates for the pixel shader.
	output.tex = input.Tex;

	// Calculate the normal vector against the world matrix only.
	output.normal = mul(input.Normal, (float3x3)world);

	// Normalize the normal vector.
	output.normal = normalize(output.normal);

	return output;
}